<?php
$server = "localhost";
$user 	= "yellow";
$pass	= "";

$conn = mysql_connect($server,$user,$pass) or die(mysql_error());

$db = $_GET["db"];
if(!isset($db)){
	$res = mysql_query("SHOW DATABASES");
	if(mysql_num_rows($res)){
		?><form method="GET" action=""><select name="db"><?php
		while ($row = mysql_fetch_row($res)) {
			?><option><?php echo $row[0]; ?></option><?php
		}
		?></select><input type="submit" value="check" /></form><?php
	}else{
		echo "No databases on $server";
	}
	die();
}



mysql_select_db($db) or die(mysql_error());
$res = mysql_query("SHOW TABLES");
$num_tables = mysql_num_rows($res);
if($num_tables){
	echo "<strong>$num_tables tables in $db:</strong><br /><ul type=\"disc\">";
	while ($row = mysql_fetch_row($res)){
		$table = $row[0];
		$chk = mysql_query("CHECK TABLE $table");
		echo "<li style=\"margin-bottom:10px;\"><b>$table</b>";
		echo "<ul type=\"none\">";
		while ($chk_row = mysql_fetch_row($chk)) {
			echo '
			<li>'.$chk_row[2].': '.$chk_row[3].'</li>
			';
		}
		
		echo "</ul>";
		echo "</li>";
	}
	echo "</ul>";
}else{
	echo "No tables in $db";
}

?>